Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grpc: Refactor decode method #32676

Merged
merged 19 commits into from
Mar 29, 2024
Merged

grpc: Refactor decode method #32676

merged 19 commits into from
Mar 29, 2024

Conversation

tyxia
Copy link
Member

@tyxia tyxia commented Mar 4, 2024

This PR is to improve the error status/code

In PR #32511, we introduce a max_frame_length feature (optional) . Now gRPC frame decoding can fail EITHER (1) due to decoding error OR (2) due to over-frame-limit error.

To better surface the error message, this PR refactor return type from bool to absl::status , so that the caller site can differentiate the error status. source/common/grpc/async_client_impl.cc in this PR can be an user example

Signed-off-by: tyxia <tyxia@google.com>
Signed-off-by: tyxia <tyxia@google.com>
Signed-off-by: tyxia <tyxia@google.com>
Signed-off-by: tyxia <tyxia@google.com>
Signed-off-by: tyxia <tyxia@google.com>
Signed-off-by: tyxia <tyxia@google.com>
Signed-off-by: tyxia <tyxia@google.com>
Signed-off-by: tyxia <tyxia@google.com>
Signed-off-by: tyxia <tyxia@google.com>
Signed-off-by: tyxia <tyxia@google.com>
Copy link

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #32676 was opened by tyxia.

see: more, trace.

Signed-off-by: tyxia <tyxia@google.com>
Signed-off-by: tyxia <tyxia@google.com>
…codec_client

Signed-off-by: tyxia <tyxia@google.com>
Signed-off-by: tyxia <tyxia@google.com>
@tyxia
Copy link
Member Author

tyxia commented Mar 6, 2024

/assign @yanavlasov @htuch

@tyxia tyxia marked this pull request as draft March 7, 2024 22:44
Copy link
Contributor

@yanavlasov yanavlasov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a good approach. Please make in non-draft when it is ready for review

@tyxia tyxia marked this pull request as ready for review March 8, 2024 18:24
@tyxia
Copy link
Member Author

tyxia commented Mar 8, 2024

Looks like a good approach. Please make in non-draft when it is ready for review

Thank for review! This PR is ready for review. (I just temporarily marked it as draft to prioritize my other outstanding PRs, as this pr is for status code improvement)

I will reopen this PR once the other gRPC change is merged

@tyxia tyxia marked this pull request as draft March 8, 2024 18:59
@tyxia tyxia marked this pull request as ready for review March 11, 2024 14:04
Copy link
Contributor

@yanavlasov yanavlasov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/wait-any

source/common/grpc/async_client_impl.cc Outdated Show resolved Hide resolved
Signed-off-by: tyxia <tyxia@google.com>
Signed-off-by: tyxia <tyxia@google.com>
@tyxia
Copy link
Member Author

tyxia commented Mar 11, 2024

/retest

@tyxia
Copy link
Member Author

tyxia commented Mar 11, 2024

/wait

Add release note before submission

@tyxia
Copy link
Member Author

tyxia commented Mar 12, 2024

/retest

@@ -300,7 +300,7 @@ Http::FilterDataStatus GrpcWebFilter::encodeData(Buffer::Instance& data, bool en
// The decoder always consumes and drains the given buffer. Incomplete data frame is buffered
// inside the decoder.
std::vector<Grpc::Frame> frames;
decoder_.decode(data, frames);
std::ignore = decoder_.decode(data, frames);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these turn into TODOs or bugs?

Copy link
Member Author

@tyxia tyxia Mar 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODOs is probably better?

I am hoping to leave it to filter owner to make the call and do the change accordingly @TAOXUY @nareddyt @lizan

Signed-off-by: tyxia <tyxia@google.com>
Signed-off-by: tyxia <tyxia@google.com>
Signed-off-by: tyxia <tyxia@google.com>
@yanavlasov
Copy link
Contributor

Waiting for final review from @htuch

/wait-any

Copy link
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@htuch htuch merged commit 77458ea into envoyproxy:main Mar 29, 2024
53 checks passed
@tyxia tyxia deleted the grpc_codec_client branch April 1, 2024 21:26
alyssawilk pushed a commit to alyssawilk/envoy that referenced this pull request Apr 29, 2024
This PR is to improve the error status/code

In PR envoyproxy#32511, we introduce a max_frame_length feature (optional) . Now gRPC frame decoding can fail EITHER (1) due to decoding error OR (2) due to over-frame-limit error.

To better surface the error message, this PR refactor return type from bool to absl::status , so that the caller site can differentiate the error status. source/common/grpc/async_client_impl.cc in this PR can be an user example

Risk level: Low
Testing: Unit tests

Signed-off-by: tyxia <tyxia@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants